#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" a simple program that let you test if you have dead pixels on your screen """

import pygame
from pygame.locals import *

screenColors = [pygame.Color(255, 0, 0),
                pygame.Color(0, 255, 0),
                pygame.Color(0, 0, 255),
                pygame.Color(255, 255, 255),
                pygame.Color(0, 0, 0)]

def getNextColor():
    currentColor=0
    while True:
        currentColor+=1
        yield screenColors[currentColor%len(screenColors)]

if __name__=="__main__":
    pygame.init()
    clock = pygame.time.Clock()
    screen = pygame.display.set_mode(pygame.display.list_modes()[0], FULLSCREEN)
    colors = getNextColor()
    color = colors.next()
    running = True
    while running:
        clock.tick(30)
        #keyboard events
        for event in pygame.event.get():
            if event.type == QUIT: running = False
            elif event.type == KEYDOWN:
                if event.key == K_ESCAPE: running = False
                else: color = colors.next()
        screen.fill(color)
        pygame.display.flip()
